package org.zoomdev.zoom.validator.impl;

import org.zoomdev.zoom.validator.Validator;
import org.zoomdev.zoom.validator.annotations.NotBlank;

public class NotBlankValidator implements Validator {
    private final String message;

    public NotBlankValidator(NotBlank notBlank) {

        this.message = notBlank.message();
    }

    @Override
    public boolean isValid(Object value) {
        if (value instanceof String) {
            return ((String) value).trim().length() > 0;
        }
        return true; // 非字符串类型由其他验证器处理
    }

    @Override
    public String getMessage() {
        return message;
    }


}